
(defparameter *top-goals*
	(freqlist-to-problist '( ;; converts the numbers to probs
		((_top-goal ?loc) . 1)
	))
)

(make-domain 'monroe '(
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Top level schedule
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Initialization code
	(:method (_initialize)
		((initialized))
		()
	)
	(:method (_initialize)
		((not (initialized)))
		((!_init) (!_init-calendar))
	)
	(:operator (!_init)
		()
		()
		((initialized))
	)
;;; Top goal
	(:method (_top-goal ?loc)
		normal
		()
		(
			(_initialize)
			(_oneday)
			(_UpdateDay)
		)
	)
;;; Oneday
	(:method (_oneday)
		normal
		()
		(
			(_BecomeHungry) (_time-morning)
			(_time-beforenoon)
			(_BeforenoonHook)
			(_BecomeHungry) (_time-noon)
			(_time-afternoon)
			(_AfternoonHook)
			(_BecomeHungry) (_time-evening)
			(_time-night)
		)
	)
;;; Hook placeholders for various derived domains.
	(:method :weight 1 (_BeforenoonHook)
		()
		((_ExtensionGoal))
	)
	(:method :weight 1 (_AfternoonHook)
		()
		((_ExtensionGoal))
	)
	; Extension goal is something that other domains might want to define to insert up to two episodes a da y into the tree.
	(:method :weight 1 (_ExtensionGoal)
		empty
		()
		()
	)
;;; High-level schedule - We provide a fact (day ?) that indicates which day it is. This allows
; for scheduling events to happen for example on wednesday only. Similar facts are provided for other
; life phases. For simplicity, some of the temporal schemas are not as they should be:
; week - 7 days
; month - !! 4 weeks
; season - 3 months; Note that for simplicity again, winter starts in january
; year - 12 months (season = 3 months)
; life phases:
;  - infant 0-1
;  - baby 2-5
;  - child 6-10
;  - teen 11-20
;  - adult 21-40
;  - mature 41-60
;  - senior 61-...
; This also theoretically allows labelling: ((day ?myarg) (SubGoal ?myarg))
; These methods and the above invocation at the end of the day ensure automatic changes of these.
	(:operator (!_init-calendar) () () ((day mon) (week one) (month jan) (season spring) (year y0) (was y0) (lifephase infant) (was infant)))
; Weekdays
	(:operator (!_settue) () ((day mon)) ((day tue)))
	(:operator (!_setwed) () ((day tue)) ((day wed)))
	(:operator (!_setthu) () ((day wed)) ((day thu)))
	(:operator (!_setfri) () ((day thu)) ((day fri)))
	(:operator (!_setsat) () ((day fri)) ((day sat)))
	(:operator (!_setsun) () ((day sat)) ((day sun)))
	(:operator (!_setmon) () ((day sun)) ((day mon)))
	(:method (_UpdateDay) mon ((day mon)) ((!_settue)))
	(:method (_UpdateDay) tue ((day tue)) ((!_setwed)))
	(:method (_UpdateDay) wed ((day wed)) ((!_setthu)))
	(:method (_UpdateDay) thu ((day thu)) ((!_setfri)))
	(:method (_UpdateDay) fri ((day fri)) ((!_setsat)))
	(:method (_UpdateDay) sat ((day sat)) ((!_setsun)))
	(:method (_UpdateDay) sun ((day sun)) ((!_setmon) (_UpdateWeek)))
; Weeks
	(:operator (!_setweekone) () ((week four)) ((week one)))
	(:operator (!_setweektwo) () ((week one)) ((week two)))
	(:operator (!_setweekthree) () ((week two)) ((week three)))
	(:operator (!_setweekfour) () ((week three)) ((week four)))
	(:method (_UpdateWeek) one ((week one)) ((!_setweektwo)))
	(:method (_UpdateWeek) two ((week two)) ((!_setweekthree)))
	(:method (_UpdateWeek) three ((week three)) ((!_setweekfour)))
	(:method (_UpdateWeek) four ((week four)) ((!_setweekone) (_UpdateMonth)))
; Months
	(:operator (!_setmonthjan) () ((month dec)) ((month jan)))
	(:operator (!_setmonthfeb) () ((month jan)) ((month feb)))
	(:operator (!_setmonthmar) () ((month feb)) ((month mar)))
	(:operator (!_setmonthapr) () ((month mar)) ((month apr)))
	(:operator (!_setmonthmay) () ((month apr)) ((month may)))
	(:operator (!_setmonthjun) () ((month may)) ((month jun)))
	(:operator (!_setmonthjul) () ((month jun)) ((month jul)))
	(:operator (!_setmonthaug) () ((month jul)) ((month aug)))
	(:operator (!_setmonthsep) () ((month aug)) ((month sep)))
	(:operator (!_setmonthoct) () ((month sep)) ((month oct)))
	(:operator (!_setmonthnov) () ((month oct)) ((month nov)))
	(:operator (!_setmonthdec) () ((month nov)) ((month dec)))
	(:method (_UpdateMonth) jan ((month jan)) ((!_setmonthfeb)))
	(:method (_UpdateMonth) feb ((month feb)) ((!_setmonthmar)))
	(:method (_UpdateMonth) mar ((month mar)) ((!_setmonthapr) (_UpdateSeason)))
	(:method (_UpdateMonth) apr ((month apr)) ((!_setmonthmay)))
	(:method (_UpdateMonth) may ((month may)) ((!_setmonthjun)))
	(:method (_UpdateMonth) jun ((month jun)) ((!_setmonthjul) (_UpdateSeason)))
	(:method (_UpdateMonth) jul ((month jul)) ((!_setmonthaug)))
	(:method (_UpdateMonth) aug ((month aug)) ((!_setmonthsep)))
	(:method (_UpdateMonth) sep ((month sep)) ((!_setmonthoct) (_UpdateSeason)))
	(:method (_UpdateMonth) oct ((month oct)) ((!_setmonthnov)))
	(:method (_UpdateMonth) nov ((month nov)) ((!_setmonthdec)))
	(:method (_UpdateMonth) dec ((month dec)) ((!_setmonthjan) (_UpdateSeason)))
; Seasons
	(:operator (!_setseasonspring) () ((season winter)) ((season spring)))
	(:operator (!_setseasonsummer) () ((season spring)) ((season summer)))
	(:operator (!_setseasonautumn) () ((season summer)) ((season autumn)))
	(:operator (!_setseasonwinter) () ((season autumn)) ((season winter)))
	(:method (_UpdateSeason) spring ((season spring)) ((!_setseasonsummer)))
	(:method (_UpdateSeason) summer ((season summer)) ((!_setseasonautumn)))
	(:method (_UpdateSeason) autumn ((season autumn)) ((!_setseasonwinter)))
	(:method (_UpdateSeason) winter ((season winter)) ((!_setseasonspring) (_UpdateYear)))
; Years
	(:operator (!_setyear1) () ((year y0)) ((year y1) (was y1)))
	(:operator (!_setyear2) () ((year y1)) ((year y2) (was y2)))
	(:operator (!_setyear3) () ((year y2)) ((year y3) (was y3)))
	(:operator (!_setyear4) () ((year y3)) ((year y4) (was y4)))
	(:operator (!_setyear5) () ((year y4)) ((year y5) (was y5)))
	(:operator (!_setyear6) () ((year y5)) ((year y6) (was y6)))
	(:operator (!_setyear7) () ((year y6)) ((year y7) (was y7)))
	(:operator (!_setyear8) () ((year y7)) ((year y8) (was y8)))
	(:operator (!_setyear9) () ((year y8)) ((year y9) (was y9)))
	(:operator (!_setyear10) () ((year y9)) ((year y10) (was y10)))
	(:operator (!_setyear11) () ((year y10)) ((year y11) (was y11)))
	(:operator (!_setyear12) () ((year y11)) ((year y12) (was y12)))
	(:operator (!_setyear13) () ((year y12)) ((year y13) (was y13)))
	(:operator (!_setyear14) () ((year y13)) ((year y14) (was y14)))
	(:operator (!_setyear15) () ((year y14)) ((year y15) (was y15)))
	(:operator (!_setyear16) () ((year y15)) ((year y16) (was y16)))
	(:operator (!_setyear17) () ((year y16)) ((year y17) (was y17)))
	(:operator (!_setyear18) () ((year y17)) ((year y18) (was y18)))
	(:operator (!_setyear19) () ((year y18)) ((year y19) (was y19)))
	(:operator (!_setyear20) () ((year y19)) ((year y20) (was y20)))
	(:operator (!_setyear21) () ((year y20)) ((year y21) (was y21)))
	(:operator (!_setyear22) () ((year y21)) ((year y22) (was y22)))
	(:operator (!_setyear23) () ((year y22)) ((year y23) (was y23)))
	(:operator (!_setyear24) () ((year y23)) ((year y24) (was y24)))
	(:operator (!_setyear25) () ((year y24)) ((year y25) (was y25)))
	(:operator (!_setyear26) () ((year y25)) ((year y26) (was y26)))
	(:operator (!_setyear27) () ((year y26)) ((year y27) (was y27)))
	(:operator (!_setyear28) () ((year y27)) ((year y28) (was y28)))
	(:operator (!_setyear29) () ((year y28)) ((year y29) (was y29)))
	(:operator (!_setyear30) () ((year y29)) ((year y30) (was y30)))
	(:operator (!_setyear31) () ((year y30)) ((year y31) (was y31)))
	(:operator (!_setyear32) () ((year y31)) ((year y32) (was y32)))
	(:operator (!_setyear33) () ((year y32)) ((year y33) (was y33)))
	(:operator (!_setyear34) () ((year y33)) ((year y34) (was y34)))
	(:operator (!_setyear35) () ((year y34)) ((year y35) (was y35)))
	(:operator (!_setyear36) () ((year y35)) ((year y36) (was y36)))
	(:operator (!_setyear37) () ((year y36)) ((year y37) (was y37)))
	(:operator (!_setyear38) () ((year y37)) ((year y38) (was y38)))
	(:operator (!_setyear39) () ((year y38)) ((year y39) (was y39)))
	(:operator (!_setyear40) () ((year y39)) ((year y40) (was y40)))
	(:operator (!_setyear41) () ((year y40)) ((year y41) (was y41)))
	(:operator (!_setyear42) () ((year y41)) ((year y42) (was y42)))
	(:operator (!_setyear43) () ((year y42)) ((year y43) (was y43)))
	(:operator (!_setyear44) () ((year y43)) ((year y44) (was y44)))
	(:operator (!_setyear45) () ((year y44)) ((year y45) (was y45)))
	(:operator (!_setyear46) () ((year y45)) ((year y46) (was y46)))
	(:operator (!_setyear47) () ((year y46)) ((year y47) (was y47)))
	(:operator (!_setyear48) () ((year y47)) ((year y48) (was y48)))
	(:operator (!_setyear49) () ((year y48)) ((year y49) (was y49)))
	(:operator (!_setyear50) () ((year y49)) ((year y50) (was y50)))
	(:operator (!_setyear51) () ((year y50)) ((year y51) (was y51)))
	(:operator (!_setyear52) () ((year y51)) ((year y52) (was y52)))
	(:operator (!_setyear53) () ((year y52)) ((year y53) (was y53)))
	(:operator (!_setyear54) () ((year y53)) ((year y54) (was y54)))
	(:operator (!_setyear55) () ((year y54)) ((year y55) (was y55)))
	(:operator (!_setyear56) () ((year y55)) ((year y56) (was y56)))
	(:operator (!_setyear57) () ((year y56)) ((year y57) (was y57)))
	(:operator (!_setyear58) () ((year y57)) ((year y58) (was y58)))
	(:operator (!_setyear59) () ((year y58)) ((year y59) (was y59)))
	(:operator (!_setyear60) () ((year y59)) ((year y60) (was y60)))
	(:operator (!_setyear61) () ((year y60)) ((year y61) (was y61)))
	(:operator (!_setyear62) () ((year y61)) ((year y62) (was y62)))
	(:operator (!_setyear63) () ((year y62)) ((year y63) (was y63)))
	(:operator (!_setyear64) () ((year y63)) ((year y64) (was y64)))
	(:operator (!_setyear65) () ((year y64)) ((year y65) (was y65)))
	(:operator (!_setyear66) () ((year y65)) ((year y66) (was y66)))
	(:operator (!_setyear67) () ((year y66)) ((year y67) (was y67)))
	(:operator (!_setyear68) () ((year y67)) ((year y68) (was y68)))
	(:operator (!_setyear69) () ((year y68)) ((year y69) (was y69)))
	(:operator (!_setyear70) () ((year y69)) ((year y70) (was y70)))
	(:operator (!_setyear71) () ((year y70)) ((year y71) (was y71)))
	(:operator (!_setyear72) () ((year y71)) ((year y72) (was y72)))
	(:operator (!_setyear73) () ((year y72)) ((year y73) (was y73)))
	(:operator (!_setyear74) () ((year y73)) ((year y74) (was y74)))
	(:operator (!_setyear75) () ((year y74)) ((year y75) (was y75)))
	(:operator (!_setyear76) () ((year y75)) ((year y76) (was y76)))
	(:operator (!_setyear77) () ((year y76)) ((year y77) (was y77)))
	(:operator (!_setyear78) () ((year y77)) ((year y78) (was y78)))
	(:operator (!_setyear79) () ((year y78)) ((year y79) (was y79)))
	(:operator (!_setyear80) () ((year y79)) ((year y80) (was y80)))
	(:method (_UpdateYear) y0 ((year y0)) ((!_setyear1)))
	(:method (_UpdateYear) y1 ((year y1)) ((!_setyear2) (!_setphasebaby)))
	(:method (_UpdateYear) y2 ((year y2)) ((!_setyear3)))
	(:method (_UpdateYear) y3 ((year y3)) ((!_setyear4)))
	(:method (_UpdateYear) y4 ((year y4)) ((!_setyear5)))
	(:method (_UpdateYear) y5 ((year y5)) ((!_setyear6) (!_setphasechild)))
	(:method (_UpdateYear) y6 ((year y6)) ((!_setyear7)))
	(:method (_UpdateYear) y7 ((year y7)) ((!_setyear8)))
	(:method (_UpdateYear) y8 ((year y8)) ((!_setyear9)))
	(:method (_UpdateYear) y9 ((year y9)) ((!_setyear10)))
	(:method (_UpdateYear) y10 ((year y10)) ((!_setyear11) (!_setphaseteen)))
	(:method (_UpdateYear) y11 ((year y11)) ((!_setyear12)))
	(:method (_UpdateYear) y12 ((year y12)) ((!_setyear13)))
	(:method (_UpdateYear) y13 ((year y13)) ((!_setyear14)))
	(:method (_UpdateYear) y14 ((year y14)) ((!_setyear15)))
	(:method (_UpdateYear) y15 ((year y15)) ((!_setyear16)))
	(:method (_UpdateYear) y16 ((year y16)) ((!_setyear17)))
	(:method (_UpdateYear) y17 ((year y17)) ((!_setyear18)))
	(:method (_UpdateYear) y18 ((year y18)) ((!_setyear19)))
	(:method (_UpdateYear) y19 ((year y19)) ((!_setyear20) (!_setphaseadult)))
	(:method (_UpdateYear) y20 ((year y20)) ((!_setyear21)))
	(:method (_UpdateYear) y21 ((year y21)) ((!_setyear22)))
	(:method (_UpdateYear) y22 ((year y22)) ((!_setyear23)))
	(:method (_UpdateYear) y23 ((year y23)) ((!_setyear24)))
	(:method (_UpdateYear) y24 ((year y24)) ((!_setyear25)))
	(:method (_UpdateYear) y25 ((year y25)) ((!_setyear26)))
	(:method (_UpdateYear) y26 ((year y26)) ((!_setyear27)))
	(:method (_UpdateYear) y27 ((year y27)) ((!_setyear28)))
	(:method (_UpdateYear) y28 ((year y28)) ((!_setyear29)))
	(:method (_UpdateYear) y29 ((year y29)) ((!_setyear30)))
	(:method (_UpdateYear) y30 ((year y30)) ((!_setyear31)))
	(:method (_UpdateYear) y31 ((year y31)) ((!_setyear32)))
	(:method (_UpdateYear) y32 ((year y32)) ((!_setyear33)))
	(:method (_UpdateYear) y33 ((year y33)) ((!_setyear34)))
	(:method (_UpdateYear) y34 ((year y34)) ((!_setyear35)))
	(:method (_UpdateYear) y35 ((year y35)) ((!_setyear36)))
	(:method (_UpdateYear) y36 ((year y36)) ((!_setyear37)))
	(:method (_UpdateYear) y37 ((year y37)) ((!_setyear38)))
	(:method (_UpdateYear) y38 ((year y38)) ((!_setyear39)))
	(:method (_UpdateYear) y39 ((year y39)) ((!_setyear40) (!_setphasemature)))
	(:method (_UpdateYear) y40 ((year y40)) ((!_setyear41)))
	(:method (_UpdateYear) y41 ((year y41)) ((!_setyear42)))
	(:method (_UpdateYear) y42 ((year y42)) ((!_setyear43)))
	(:method (_UpdateYear) y43 ((year y43)) ((!_setyear44)))
	(:method (_UpdateYear) y44 ((year y44)) ((!_setyear45)))
	(:method (_UpdateYear) y45 ((year y45)) ((!_setyear46)))
	(:method (_UpdateYear) y46 ((year y46)) ((!_setyear47)))
	(:method (_UpdateYear) y47 ((year y47)) ((!_setyear48)))
	(:method (_UpdateYear) y48 ((year y48)) ((!_setyear49)))
	(:method (_UpdateYear) y49 ((year y49)) ((!_setyear50)))
	(:method (_UpdateYear) y50 ((year y50)) ((!_setyear51)))
	(:method (_UpdateYear) y51 ((year y51)) ((!_setyear52)))
	(:method (_UpdateYear) y52 ((year y52)) ((!_setyear53)))
	(:method (_UpdateYear) y53 ((year y53)) ((!_setyear54)))
	(:method (_UpdateYear) y54 ((year y54)) ((!_setyear55)))
	(:method (_UpdateYear) y55 ((year y55)) ((!_setyear56)))
	(:method (_UpdateYear) y56 ((year y56)) ((!_setyear57)))
	(:method (_UpdateYear) y57 ((year y57)) ((!_setyear58)))
	(:method (_UpdateYear) y58 ((year y58)) ((!_setyear59)))
	(:method (_UpdateYear) y59 ((year y59)) ((!_setyear60) (!_setphasesenior)))
	(:method (_UpdateYear) y60 ((year y60)) ((!_setyear61)))
	(:method (_UpdateYear) y61 ((year y61)) ((!_setyear62)))
	(:method (_UpdateYear) y62 ((year y62)) ((!_setyear63)))
	(:method (_UpdateYear) y63 ((year y63)) ((!_setyear64)))
	(:method (_UpdateYear) y64 ((year y64)) ((!_setyear65)))
	(:method (_UpdateYear) y65 ((year y65)) ((!_setyear66)))
	(:method (_UpdateYear) y66 ((year y66)) ((!_setyear67)))
	(:method (_UpdateYear) y67 ((year y67)) ((!_setyear68)))
	(:method (_UpdateYear) y68 ((year y68)) ((!_setyear69)))
	(:method (_UpdateYear) y69 ((year y69)) ((!_setyear70)))
	(:method (_UpdateYear) y70 ((year y70)) ((!_setyear71)))
	(:method (_UpdateYear) y71 ((year y71)) ((!_setyear72)))
	(:method (_UpdateYear) y72 ((year y72)) ((!_setyear73)))
	(:method (_UpdateYear) y73 ((year y73)) ((!_setyear74)))
	(:method (_UpdateYear) y74 ((year y74)) ((!_setyear75)))
	(:method (_UpdateYear) y75 ((year y75)) ((!_setyear76)))
	(:method (_UpdateYear) y76 ((year y76)) ((!_setyear77)))
	(:method (_UpdateYear) y77 ((year y77)) ((!_setyear78)))
	(:method (_UpdateYear) y78 ((year y78)) ((!_setyear79)))
	(:method (_UpdateYear) y79 ((year y79)) ((!_setyear80)))
; This is the stop ageing. Gotta wish it was that easy, eh?
; It prevents plans running longer from failing at this point.
	(:method (_UpdateYear) y80 ((year y80)) ())
; Life phases
	(:operator (!_setphasebaby) () ((lifephase infant)) ((lifephase baby) (was baby)))
	(:operator (!_setphasechild) () ((lifephase baby)) ((lifephase child) (was child)))
	(:operator (!_setphaseteen) () ((lifephase child)) ((lifephase teen) (was teen)))
	(:operator (!_setphaseadult) () ((lifephase teen)) ((lifephase adult) (was adult)))
	(:operator (!_setphasemature) () ((lifephase adult)) ((lifephase mature) (was mature)))
	(:operator (!_setphasesenior) () ((lifephase mature)) ((lifephase senior) (was senior)))

;;; LispBots internal scheduling. These actions are directly recognised
;;; by the parser and interpretted, rather than inserted into memory.
; Internal operator; We use this to indicate that 4 hours should be added to the day. This forms
; a basic schedule:
; earlymorning - 2-6
; morning - 6-10
; noon - 10-14
; afternoon - 14-18
; evening - 18-22
; night - 22-2
    (:operator (!lispbots-4hours) () () ())
; Internal operator to indicate sleep (and memory reorganization)
	(:operator (!lispbots-sleep) () () ())
; These operators should never make it into the actual memory.
; morning
	(:method (_time-morning)
		((day ?day) (week ?week) (month ?month) (season ?season) (year ?year) (lifephase ?phase))
		((_morning-action ?day ?week ?month ?season ?year ?phase) (!lispbots-4hours))
	)
	(:method (_morning-action ?day ?week ?month ?season ?year ?phase)
		oversleep
		((asleep ?object) (affordance ?here to-sleep ?object))
		((DoShortSleep ?object) (WakeUp ?object) (Shower ?here) (BrushTeeth ?here))
	)
	(:method :weight 3 (_morning-action)
		hygiene
		((asleep ?object) (affordance ?here to-sleep ?object))
		((WakeUp ?object) (Shower ?here) (BrushTeeth ?here))
	)
; beforenoon
	(:method (_time-beforenoon)
		()
		(
			(_beforenoon-action) (_beforenoon-action) (_beforenoon-action) (_beforenoon-action) (_beforenoon-action) (_beforenoon-action) (_beforenoon-action) (_beforenoon-action)
			(!lispbots-4hours)
		)
	)

	(:method :weight 3 (_beforenoon-action)
		prace
		()
		((Work))
	)
	(:method (_beforenoon-action)
		svacina
		()
		((SatisfyHunger))
	)
	(:method (_beforenoon-action)
		zachod
		()
		((SeekToilet))
	)
	(:method (_beforenoon-action)
		flakarna
		()
		()
	)
; noon
	(:method (_time-noon)
		()
		((_noon-action) (!lispbots-4hours))
	)

	(:method (_noon-action)
		normal
		()
		((SatisfyHunger))
	)
; afternoon-action
	(:method (_time-afternoon)
		()
		(
			(_afternoon-action) (_afternoon-action) (_afternoon-action) (_afternoon-action) (_afternoon-action) (_afternoon-action) (_afternoon-action) (_afternoon-action)
			(!lispbots-4hours)
		)
	)
	(:method :weight 3 (_afternoon-action)
		work
		()
		((Work))
	)
	(:method (_afternoon-action)
		snack
		()
		((SatisfyHunger))
	)
	(:method (_afternoon-action)
		toilet
		()
		((SeekToilet))
	)
	; empty node
	(:method (_afternoon-action)
		idle
		()
		()
	)
; evening-action
	(:method (_time-evening)
		()
		((_evening-action) (!lispbots-4hours))
	)

	(:method (_evening-action)
		work
		()
		((Work))
	)
	(:method :weight 3 (_evening-action)
		entertainment
		()
		((GoToPub))
	)
	; empty node
	(:method (_evening-action)
		idle
		()
		((DoNothing))
	)
; night-action
	(:method (_time-night)
		()
		((_night-action) (!lispbots-4hours) (!lispbots-sleep))
	)

	(:method :weight 4 (_night-action)
		normal
		()
		(
			(BrushTeeth)
			(GoToSleep)
		)
	)
	(:method (_night-action)
		partynight
		()
		(
			(GoToPub)
			(GoToSleep)
		)
	)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Goals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; SatisfyHunger
	(:method :weight 2 (SatisfyHunger)
		eat-outside
		((hungry) (affordance ?place to-eat) (affordance ?place menu ?food))
		((GetTo ?place) (!order ?food) (!eat ?food test) (!drink))
	)
	(:method (SatisfyHunger)
		cook-anywhere
		; cook anything that exists anywhere on the menu (TODO: better way)
		((hungry) (affordance ?place to-cook ?stove) (affordance ?anywhere menu ?food))
		((GetTo ?place) (Cook ?stove ?food) (!eat ?food test) (!drink))
	)
	; Usually eats at home, can always cook at home
	(:method :weight 5 (SatisfyHunger)
		cook-at-home
		((hungry) (affordance ?place ishome) (affordance ?place to-cook ?stove) (affordance ?anywhere menu ?food))
		((GetTo ?place) (Cook ?stove ?food) (!eat ?food test) (!drink))
	)
	(:method (_BecomeHungry)
		noop
		((hungry))
		()
	)
	(:method (_BecomeHungry)
		no-hungry
		((not (hungry)))
		((!_becomehungry))
	)
	(:operator (!_becomehungry)
		() () ((hungry))
	)
	(:operator (!eat ?food test)
		() ((hungry)) ()
	)
	(:operator (!drink)
		() () ()
	)
	(:operator (!order ?food)
		() () ()
	)
;;; Cook
	(:method (Cook ?stove ?food)
		()
		((!get-ingredients) (!mix-ingredients) (!light-stove ?stove) (!cook ?stove ?food))
	)
	(:operator (!get-ingredients)
		() () ()
	)
	(:operator (!mix-ingredients)
		() () ()
	)
	(:operator (!light-stove ?stove)
		() () ()
	)
	(:operator (!cook ?stove ?food)
		() () ()
	)
;;; GoToPub
	(:method (GoToPub)
		((affordance ?place ispub))
		((GetTo ?place) (PubAction) (PubAction) (PubAction) (PubAction))
	)
	(:method (PubAction)
		have-beer
		()
		((!order-beer) (!drink))
	)
	(:method (PubAction)
		dance
		()
		((!dance))
	)
	(:method (PubAction)
		sing
		()
		((!sing))
	)
	(:method (PubAction)
		sing
		()
		((!chat))
	)
	(:operator (!order-beer)
		() () ()
	)
	(:operator (!sing)
		() () ()
	)
	(:operator (!dance)
		() () ()
	)
	(:operator (!chat)
		() () ()
	)
;;; Shower
	(:method (Shower ?place)
		noop
		()
		()
	)
	(:method :weight 30 (Shower ?place)
		normal
		((affordance ?place has-shower ?shower))
		((!undress me) (!turn-on-shower ?shower) (!use-soap ?shower) (!shower ?shower) (!turn-off-shower ?shower) (!use-towel ?shower) (!dress me))
	)
	(:operator (!undress ?who)
		() () ()
	)
	(:operator (!dress ?who)
		() () ()
	)
	(:operator (!turn-on-shower ?shower)
		() () ()
	)
	(:operator (!turn-off-shower ?shower)
		() () ()
	)
	(:operator (!use-towel ?shower)
		() () ()
	)
	(:operator (!shower ?shower)
		() () ()
	)
;;; BrushTeeth
	(:method (BrushTeeth ?place)
		noop
		()
		()
	)
	(:method :weight 20 (BrushTeeth ?place)
		normal
		((affordance ?place has-toothbrush ?brush) (affordance ?place has-sink ?sink))
		((!turn-on-sink ?sink) (!brushteeth ?brush) (!turn-off-sink ?sink))
	)
	(:operator (!brushteeth ?brush)
		() () ()
	)
;;; WashHands
	(:method (WashHands ?place)
		noop
		()
		((!not-wash-hands))
	)
    ; usually washes hands, sometimes not
	(:method :weight 20 (WashHands ?place)
		normal
		((affordance ?place has-sink ?sink))
		((!turn-on-sink ?sink) (!use-soap ?sink) (!wash-hands ?sink) (!turn-off-sink ?sink))
	)
	(:method :weight 20 (WashHands ?place)
		no-sink
		((not (affordance ?place has-sink ?any)))
		((!not-wash-hands))
	)
	(:operator (!use-soap ?sink)
		() () ()
	)
	(:operator (!wash-hands ?sink)
		() () ()
	)
	(:operator (!turn-on-sink ?sink)
		() () ()
	)
	(:operator (!turn-off-sink ?sink)
		() () ()
	)
	(:operator (!not-wash-hands)
		() () ()
	)
;;; GoToSleep
	(:method (GoToSleep)
		already-home
		((atloc ?place) (affordance ?place ishome) (affordance ?place to-sleep ?object))
		((!fall-asleep ?object) (DoSleep ?object))
	)
	; usually go home
	(:method :weight 10 (GoToSleep)
		athome
		((affordance ?place ishome) (affordance ?place to-sleep ?object))
		((GetTo ?place) (!fall-asleep ?object) (DoSleep ?object))
	)
	; if not already at home, also can sleep elsewhere
	(:method (GoToSleep)
		emergency-landing
		((atloc ?now) (not (affordance ?now ishome)) (affordance ?place to-sleep ?object))
		((GetTo ?place) (!fall-asleep ?object) (DoSleep ?object))
	)
;;; Sleep
	(:method (DoShortSleep ?object)
		((asleep ?object))
		((AtomicSleep ?object) (AtomicSleep ?object) (AtomicSleep ?object))
	)
	(:method (DoSleep ?object)
		((asleep ?object))
		; many sleep actions per sleep
		((AtomicSleep ?object) (AtomicSleep ?object) (AtomicSleep ?object) (AtomicSleep ?object) (AtomicSleep ?object) (AtomicSleep ?object)
		)
	)
	(:method (WakeUp ?object)
		()
		((!wake-up ?object))
	)
	(:method (AtomicSleep ?object)
		noop
		()
		()
	)
	(:method :weight 5 (AtomicSleep ?object)
		sleep
		()
		((!sleep ?object))
	)
	(:method (AtomicSleep ?object)
		toilet
		()
		((!wake-up ?object) (SeekToilet) (!fall-asleep ?object))
	)
	(:method :weight 2 (AtomicSleep ?object)
		roll
		()
		((!turn-and-roll))
	)
	(:method (AtomicSleep ?object)
		snore
		()
		((!snore ?object))
	)
	(:operator (!sleep ?object)
		() () ()
	)
	(:operator (!snore ?object)
		() () ()
	)
	(:operator (!turn-and-roll ?object)
		() () ()
	)
	(:operator (!fall-asleep ?object)
		() () ((asleep ?object))
	)
	(:operator (!wake-up ?object)
		() ((asleep ?object)) ()
	)
;;; SeekToilet
	(:method (SeekToilet)
		here-has-toilet
		((atloc ?here) (affordance ?here has-toilet ?toilet))
		((Usetoilet ?here ?toilet))
	)
	(:method (SeekToilet)
		find-some
		((atloc ?here) (not (affordance ?here has-toilet ?any)) (affordance ?somewhere has-toilet ?toilet))
		((GetTo ?somewhere) (Usetoilet ?somewhere ?toilet))
	)
;;; Usetoilet
	(:method :weight 3 (Usetoilet ?place ?toilet)
		little-side
		()
		((!raise-seat ?toilet) (!usetoilet ?toilet) (!drop-seat ?toilet) (!flush ?toilet) (WashHands ?place))
	)
	(:method (Usetoilet ?place ?toilet)
		big-side
		()
		((!sit ?toilet) (!usetoilet ?toilet) (!readnews ?toilet) (!stand ?toilet) (!flush ?toilet) (WashHands ?place))
	)
	(:operator (!raise-seat ?toilet)
		() () ()
	)
	(:operator (!drop-seat ?toilet)
		() () ()
	)
	(:operator (!usetoilet ?toilet)
		() () ()
	)
	(:operator (!flush ?toilet)
		() () ()
	)
	(:operator (!sit ?toilet)
		() () ()
	)
	(:operator (!stand ?toilet)
		() () ()
	)
	(:operator (!readnews ?toilet)
		() () ()
	)
;;; Work
	; just use the damn computer that's right here (like, at home)
	(:method (Work)
		here-and-now
		((atloc ?here) (affordance ?here has-computer ?computer))
		((Workatcomputer ?computer))
	)
	(:method :weight 5 (Work)
		at-office
		((affordance work has-computer ?computer))
		((GetTo work) (Workatcomputer ?computer))
	)
	; work from anywhere possible, not here
	(:method (Work)
		find-some
		((atloc ?here) (not (affordance ?here has-computer ?whatever)) (affordance ?someplace has-computer ?computer))
		((GetTo ?someplace) (Workatcomputer ?computer))
	)
;;; Workatcomputer
	(:method (Workatcomputer ?computer)
		write-code
		()
		((Program ?computer) (Program ?computer) (Program ?computer) (Program ?computer))
	)
	(:method (Workatcomputer ?computer)
		write-docs
		()
		((WriteDocument ?computer) (WriteDocument ?computer) (WriteDocument ?computer))
	)
;;; WriteDocument
	(:method (WriteDocument ?computer)
		fluff
		()
		()
	)
	(:method (WriteDocument ?computer)
		doit
		()
		((!typetext ?computer) (!formatdoc ?computer) (!proofread ?computer))
	)
	(:operator (!typetext ?computer)
		() () ()
	)
	(:operator (!formatdoc ?computer)
		() () ()
	)
	(:operator (!proofread ?computer)
		() () ()
	)
;;; Program
	(:method (Program ?computer)
		fluff
		()
		()
	)
	(:method (Program ?computer)
		write-code
		()
		((!write-code ?computer) (!test-code ?computer) (!debug-code ?computer))
	)
	(:method (Program ?computer)
		write-code
		()
		((!write-code ?computer) (!debug-code ?computer) (!curse ?computer) (!debug-code ?computer) (!test-code ?computer) (!debug-code ?computer))
	)
	(:operator (!write-code ?computer)
		() () ()
	)
	(:operator (!test-code ?computer)
		() () ()
	)
	(:operator (!debug-code ?computer)
		() () ()
	)
	(:operator (!curse ?computer)
		() () ()
	)
;;;;;;;;;;;;;;;;;;;;;;;
;;; Meta goals
;;;;;;;;;;;;;;;;;;;;;;;
;; Travel
	(:method (GetTo ?loc)
		already-there
		((atloc ?loc))
		()
	)
	(:method (GetTo ?loc)
		travel-there
		((not (atloc ?loc)) (atloc ?from))
		((Travel ?from ?loc))
	)
;; Travel
	; travel axioms
	(:- (CanTravelBus ?from ?to ?bus)
		((busstop ?from) (busstop ?to) (busroute ?from ?to ?bus))
	)
	(:- (CanTravelBus ?from ?to ?bus)
		((busstop ?from) (busstop ?to) (busroute ?to ?from ?bus))
	)
	(:- (CanTravelTram ?from ?to ?tram)
		((tramstop ?from) (tramstop ?to) (tramroute ?from ?to ?tram))
	)
	(:- (CanTravelTram ?from ?to ?tram)
		((tramstop ?from) (tramstop ?to) (tramroute ?to ?from ?tram))
	)
	(:- (CanTravelCombined ?from ?to ?mid)
		((not (CanTravelBus ?from ?to ?whatever1)) (not (CanTravelTram ?from ?to ?whatever2)) (CanTravelBus ?from ?mid ?bus) (CanTravelTram ?mid ?to ?tram))
	)
	(:- (CanTravelCombined ?from ?to ?mid)
		((not (CanTravelBus ?from ?to ?whatever1)) (not (CanTravelTram ?from ?to ?whatever2)) (CanTravelTram ?from ?mid ?tram) (CanTravelBus ?mid ?to ?bus))
	)
	(:- (CanWalk ?from ?to)
		((iswalkable ?from ?to))
	)
	(:- (CanWalk ?from ?to)
		((iswalkable ?to ?from))
	)
	(:method :weight 100 (Travel ?from ?to)
		walk
		((CanWalk ?from ?to))
		((!walk ?from ?to))
	)
	(:method :weight 10 (Travel ?from ?to)
		bus-only
		((CanTravelBus ?from ?to ?bus))
		((!get-to-busstop ?from) (!wait-for-bus ?bus) (!board-bus ?bus) (!ridebus ?bus ?from ?to) (!exit-bus ?bus) (!get-from-busstop ?to))
	)
	(:method :weight 10 (Travel ?from ?to)
		tram-only
		((CanTravelTram ?from ?to ?tram))
		((!get-to-tramstop ?from) (!wait-for-tram ?tram) (!board-tram ?tram) (!ridetram ?tram ?from ?to) (!exit-tram ?tram) (!get-from-tramstop ?to))
	)
	(:method :weight 1 (Travel ?from ?to)
		both
		((CanTravelCombined ?from ?to ?mid))
		((Travel ?from ?mid) (Travel ?mid ?to))
	)
	(:operator (!get-to-busstop ?stop)
		() () ()
	)
	(:operator (!get-to-tramstop ?stop)
		() () ()
	)
	(:operator (!get-from-busstop ?stop)
		() () ()
	)
	(:operator (!get-from-tramstop ?stop)
		() () ()
	)
	(:operator (!wait-for-bus ?bus)
		() () ()
	)
	(:operator (!wait-for-tram ?tram)
		() () ()
	)
	(:operator (!board-bus ?bus)
		() () ()
	)
	(:operator (!exit-bus ?bus)
		() () ()
	)
	(:operator (!board-tram ?tram)
		() () ()
	)
	(:operator (!exit-tram ?tram)
		() () ()
	)
	(:operator (!walk ?from ?to)
		() ((atloc ?from)) ((atloc ?to))
	)
	(:operator (!ridebus ?bus ?from ?to)
		() ((atloc ?from)) ((atloc ?to))
	)
	(:operator (!ridetram ?tram ?from ?to)
		() ((atloc ?from)) ((atloc ?to))
	)
;;;;;;;;;;;;;;;;;;;;;;;
;;; Other
;;;;;;;;;;;;;;;;;;;;;;;
;;; Dummy operator
	(:method (DoNothing)
		()
		((!nothing))
	)
	(:operator (!nothing)
		() () ()
	)
)) ;; end defdomain
